using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ManagementClinic.Data.Models.Mapping
{
    public class BAC_SI_PHONG_KHAMMap : EntityTypeConfiguration<BAC_SI_PHONG_KHAM>
    {
        public BAC_SI_PHONG_KHAMMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.GHI_CHU)
                .HasMaxLength(100);

            this.Property(t => t.MODIFY_USER)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("BAC_SI_PHONG_KHAM");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.ID_PHONG_KHAM).HasColumnName("ID_PHONG_KHAM");
            this.Property(t => t.ID_BAC_SI).HasColumnName("ID_BAC_SI");
            this.Property(t => t.GHI_CHU).HasColumnName("GHI_CHU");
            this.Property(t => t.MODIFY_USER).HasColumnName("MODIFY_USER");
            this.Property(t => t.MODIFY_DATE).HasColumnName("MODIFY_DATE");

            // Relationships
            this.HasRequired(t => t.BAC_SI)
                .WithMany(t => t.BAC_SI_PHONG_KHAM)
                .HasForeignKey(d => d.ID_BAC_SI);
            this.HasRequired(t => t.PHONG_KHAM)
                .WithMany(t => t.BAC_SI_PHONG_KHAM)
                .HasForeignKey(d => d.ID_PHONG_KHAM);

        }
    }
}
